From: Jonas Dreßler Date: Wed, 7 Aug 2019 15:39:25 +0000 (+0200) Subject: search: Defer updating results on allocation changes until redraw X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~839^2^2~12 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=21966afbc6992fa825217666c2f7de55e1d61be5;p=gnome-shell.git search: Defer updating results on allocation changes until redraw Since the `notify::allocation` signal will obviously get emitted while the actor is inside an allocation cycle and we might end up doing changes to its allocation inside `updateSearch` by hiding or showing the actor (which queues a relayout), we get a warning from Clutter. Fix this by delaying the call to the parent method until the next redraw, which should happen a few moments after the current relayout. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/672 --- diff --git a/js/ui/search.js b/js/ui/search.js index 7a7a5071f..d55021ac9 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi; +const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const Signals = imports.signals; const AppDisplay = imports.ui.appDisplay; @@ -348,7 +348,10 @@ var GridSearchResults = class extends SearchResultsBase { // Make sure the maximum number of results calculated by // _getMaxDisplayedResults() is updated after width changes. this._notifyAllocationId = this.actor.connect('notify::allocation', () => { - super.updateSearch(...args); + Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { + super.updateSearch(...args); + return GLib.SOURCE_REMOVE; + }); }); super.updateSearch(...args);